﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class Product
    {
        public string ProductId { get; set; }
        public string Name { get; set; }
        public decimal Price { get; set; }

        public Product(string productId, string name, decimal price)
        {
            ProductId = productId;
            Name = name;
            Price = price;
        }

        public override bool Equals(object obj)
        {
            return obj is Product product &&
                   ProductId == product.ProductId;
        }

        public override int GetHashCode()
        {
            return ProductId?.GetHashCode() ?? 0;
        }

        public override string ToString()
        {
            return $"商品ID: {ProductId}, 名称: {Name}, 价格: {Price:C}";
        }
    }
}
